# 2  编写一个装饰器，能记录其他函数调用的日志，将日志写入到文件中；

#-*-coding:utf-8-*-
import os
import time
from functools import wraps

def log(func):
    def inner(*args,**kwargs):
        with open('log1.txt','a',encoding='utf-8') as f:
            f.write(func.__name__+'\n')
            ret = func(*args,**kwargs)
            return ret
    return  inner
@log
def shoplist_add():
    print("添加一个物品")
@log
def shoplist_del():
    print("删除一个物品")
shoplist_add()
shoplist_del()
